<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:Calcium="clr-namespace:DanielVaughan.Calcium" 
	xmlns:cal="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation" 
	xmlns:Controls="clr-namespace:DanielVaughan.Calcium.Gui.Controls" 
	xmlns:Gui="clr-namespace:DanielVaughan.Calcium.Gui">
	
	<ResourceDictionary.MergedDictionaries>
		<ResourceDictionary Source="ExpanderDictionary.xaml"/>		
	</ResourceDictionary.MergedDictionaries>
	
	<BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
	
	<Style x:Key="ChildWindowView" TargetType="{x:Type Window}">
		<Setter Property="Background" Value="{DynamicResource WindowBackgroundBrush}" />
		<Setter Property="SizeToContent" Value="WidthAndHeight" />
		<Setter Property="Title" Value="{Binding Title}" />
		<Setter Property="Icon" Value="..\..\Gui\Shell\Calcium_16x16.ico" />
		<Setter Property="Width" Value="{Binding Width}"/>
		<Setter Property="Height" Value="{Binding Height}"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Window}">
					<Grid Background="{DynamicResource WindowBackgroundBrush}">
						<Border Background="Black" BorderBrush="Black" BorderThickness="3" CornerRadius="5" Margin="10" 
								HorizontalAlignment="Center" VerticalAlignment="Center">
							<ContentPresenter />
						</Border>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	
	<Style TargetType="{x:Type Gui:ShellView}">
		<Setter Property="Icon" Value="..\..\Gui\Shell\Calcium_16x16.ico" />
		<Setter Property="Title" Value="{Binding Title}" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Gui:ShellView}">
					<Grid x:Name="PART_Grid_Root" Background="{DynamicResource WindowBackgroundBrush}">
						<Grid.ColumnDefinitions>
							<ColumnDefinition x:Name="PART_ColumnDefinition_Left" MinWidth="80"/>
							<ColumnDefinition x:Name="PART_ColumnDefinition_Center" Width="2.5*"  MinWidth="80" />
							<ColumnDefinition x:Name="PART_ColumnDefinition_Right" MinWidth="80" />
						</Grid.ColumnDefinitions>

						<Grid.RowDefinitions>
							<RowDefinition x:Name="PART_RowDefinition_Banner" Height="Auto"/>
							<RowDefinition x:Name="PART_RowDefinition_Menu" Height="Auto"/>
							<RowDefinition x:Name="PART_RowDefinition_Content" Height="2*" MinHeight="80" />
							<RowDefinition x:Name="PART_RowDefinition_OutputDisplay" MinHeight="80"/>
							<RowDefinition x:Name="PART_RowDefinition_StatusBar" Height="Auto" />
						</Grid.RowDefinitions>

						<!-- Banner -->
						<Border x:Name="PART_Border_Banner" Grid.Row="0" Grid.ColumnSpan="3" Margin="10, 0, 0, 0">
							<Expander x:Name="PART_Expander_Banner" IsExpanded="True" ExpandDirection="Down"
								  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="6"
								  Style="{DynamicResource ExpanderStyle}" 
								  Visibility="{Binding BannerVisible, Converter={StaticResource booleanToVisibilityConverter}}">
								<StackPanel x:Name="PART_StackPanel_TitleBanner" 
											cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Banner}" Orientation="Horizontal">
									<Controls:ShellBanner x:Name="PART_ShellBanner" HorizontalAlignment="Stretch" Padding="0, 0, 10, 5"
										  Visibility="{Binding LogoVisible, Converter={StaticResource booleanToVisibilityConverter}}"/>
								</StackPanel>
							</Expander>
						</Border>

						<!-- Menu -->
						<ContentControl x:Name="PART_ContentControl_Menu" Grid.Row="1" Grid.ColumnSpan="3" 
										Margin="7,0,0,5" Padding="5">
							<StackPanel x:Name="PART_StackPanel_Menu">
								<Controls:StandardMenu x:Name="PART_Menu" Margin="0, 0, 0, 0"/>
								<Controls:StandardToolBarTray x:Name="PART_ToolBar" Margin="0, 5, 0, 0"/>
							</StackPanel>
						</ContentControl>

						<!-- Workspace -->
						<Border x:Name="PART_Border_Workspace" Grid.Row="2" Grid.Column="1">
							<TabControl x:Name="PART_TabControl_Workspace"
								cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Workspace}"
								IsSynchronizedWithCurrentItem="True"  
								Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
								Margin="0,0,0,0"/>
						</Border>

						<!-- Tools Left -->
						<Border x:Name="PART_Border_Left" Grid.Row="2" Padding="0,0,1,10" Grid.RowSpan="2">
							<Expander x:Name="PART_Expander_Left" IsExpanded="True" ExpandDirection="Left"        		 
        								Style="{DynamicResource ExpanderStyle}"
        								BorderThickness="0,0,0,0" Margin="0,0,0,0">
								<TabControl x:Name="PART_TabControl_Left" 
											cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Tools}"							
											MinWidth="0" Margin="10,0,1,0"
        									HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
        									IsSynchronizedWithCurrentItem="True" BorderThickness="0,0,0,0"/>
							</Expander>
						</Border>

						<!-- ModuleManager etc., Right -->
						<Border x:Name="PART_Border_Right" Grid.Row="2" Grid.Column="2" Grid.RowSpan="2"
								HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
								Padding="1,0,0,10" Margin="0,0,0,0">
							<Expander x:Name="PART_Expander_Right" IsExpanded="True" ExpandDirection="Right"                       
								  Style="{DynamicResource ExpanderStyle}"
								  BorderThickness="0,0,0,0">
								<TabControl x:Name="PART_TabControl_Right" 
									cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Properties}"
									MinWidth="0" Margin="1,0,10,0"
									HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
									IsSynchronizedWithCurrentItem="True" BorderThickness="0,0,0,0" 
									Background="{x:Null}" Foreground="{x:Null}" BorderBrush="{x:Null}"/>
							</Expander>
						</Border>

						<!-- OutputDisplay etc. -->
						<Border x:Name="PART_Border_Bottom" Grid.Row="3" Grid.Column="1" 
								HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0">
							<Expander x:Name="PART_Expander_Bottom" IsExpanded="True"
									  MinHeight="6" Style="{DynamicResource ExpanderStyle}"
									  BorderThickness="0,0,0,0" 
									  Margin="0,0,0,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
								<TabControl x:Name="PART_TabControl_Bottom" 
											cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.Footer}"
											MinHeight="80" 
											HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
											IsSynchronizedWithCurrentItem="True" Margin="0,1,0,10" />
							</Expander>
						</Border>

						<StackPanel x:Name="PART_StackPanel_StatusBar" Grid.Row="4" Grid.ColumnSpan="3"
									cal:RegionManager.RegionName="{x:Static Calcium:RegionNames.StatusBar}"
									Orientation="Horizontal" Margin="0,-10,0,0">
						</StackPanel>

						<!-- GridSplitters -->
						<GridSplitter x:Name="PART_GridSplitter_Left" Grid.Column="0" Grid.Row="2" Grid.RowSpan="2" 
									  HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="4"
									  Opacity="0"  Margin="0,20,-4,6" />

						<GridSplitter x:Name="PART_GridSplitter_Bottom" Grid.Column="1" Grid.Row="3" Visibility="Visible" 
									  HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="4" 
									  Opacity="0" Grid.ColumnSpan="1" Margin="0,-4,0,0" />

						<GridSplitter x:Name="PART_GridSplitter_Right" Grid.Column="2" Grid.Row="2" Visibility="Visible" 
									  HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="4"  
									  Opacity="0" Margin="-4,20,0,6" Grid.RowSpan="2" />

					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>